package state;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import model.parser.ParserException;

/**
 * A class to hold the current state of the project.
 * @author djs22
 *
 */
public class WindowState {
	
	public WindowState(){
		history = new ArrayList<String>();
		tabsMap = new HashMap<Integer, TabState>();
		tabsMap.put(0, new TabState(0));
	}
	/**
	 * holds the history of the user messages
	 */
	public List<String> history;
	
	/**
	 * the tabs that exist in this window
	 */
	public Map<Integer, TabState> tabsMap;
	
	public TabState getTabState(int i){
		if (!tabsMap.containsKey(i))
			throw ParserException.TAB_NOT_EXIST;
		return tabsMap.get(i);
	}
	
	public void addTabState(int i){
		if (!tabsMap.containsKey(i))
			tabsMap.put(i, new TabState(i));
	}
}
